---
description: "Reference for Nitric's v0 JVM library - Begins a new query on a Collection."
---

# JVM - collection.query()

Begins a new query on a Collection.

<Tabs syncKey="jvm-lang">

<TabItem label="Java">

```java
import io.nitric.Nitric;
import io.nitric.resources.CollectionPermission;

// A user class to store in the profiles collection
class User {
  String name;
  int age;

  public User(String name, int age) {
    this.name = name;
    this.age = age;
  }
}

public class Application {
  public static void main(String[] args) {
    var profiles = Nitric.INSTANCE.collection("profiles", User.class).with(CollectionPermission.Read);

    var profilesQuery = profiles.query();

    Nitric.INSTANCE.run();
  }
}
```

</TabItem>

<TabItem label="Kotlin">

```kotlin
import io.nitric.Nitric
import io.nitric.resources.CollectionPermission

// A user class to store in the profiles collection
data class User(val name: String, val age: Int)

fun main() {
  val profiles = Nitric.collection<User>("profiles").with(CollectionPermission.Read)

  val profilesQuery = profiles.query()

  Nitric.run()
}
```

</TabItem>

</Tabs>

### See also

- Adding filters: [query().where()](./collection-query-where)
- Limiting the results: [query().limit()](./collection-query-limit)
- Streaming results: [query().stream()](./collection-query-stream)
- Fetching results: [query().fetch()](./collection-query-fetch)
